<?php
namespace UserApi\Controller;
use Zend\Mvc\Controller\AbstractRestfulController;
use Zend\View\Model\JsonModel;
class UsersreportsApiController extends AbstractRestfulController
{
    public function getList()
    {
		header('Access-Control-Allow-Origin: *');
    }
    public function get($id)
    {	
		header('Access-Control-Allow-Origin: *');
		$userMedicineOrderTable=$this->getServiceLocator()->get('Models\Model\UserMedicineOrderFactory');
		$explodeId=explode('-',$id);
		if($explodeId[0]=='user'){			
			$user_id=$explodeId[1];	
			$user_pending_orders_cnt    = $userMedicineOrderTable->userPendingorders($user_id);
			$user_processing_orders_cnt = $userMedicineOrderTable->userProcessingorders($user_id);
			$user_processed_orders_cnt  = $userMedicineOrderTable->userProcessedorders($user_id);
			$user_cancelled_orders_cnt  = $userMedicineOrderTable->userCancelledorders($user_id);
			// echo 'pending='.$user_pending_orders_cnt.'procing='.$user_processing_orders_cnt.'prosed='.$user_processed_orders_cnt.'cancelled='.$user_cancelled_orders_cnt;exit;
			return new JsonModel(array(
				'pending'		    => $user_pending_orders_cnt,
				'processing'		=> $user_processing_orders_cnt,
				'processed'		    => $user_processed_orders_cnt,
				'cancelled'		    => $user_cancelled_orders_cnt,
			));
		}
    }
    public function create($order)
    {	
		
    }
    public function update($order_id,$order)
    {
		
    }
    public function delete($id)
    {
       
    }
}